package com.jcroke.PC32.transformer;

import java.util.Hashtable;
import java.util.LinkedHashMap;

import com.jcroke.PC32.basetransform.DefaultTransformer;
import com.jcroke.PC32.datum.Datum;
import com.jcroke.PC32.datum.dInteger;
import com.jcroke.PC32.datum.dString;

/**
 * 
 * @author jcroke
 *
 */
public class String2IntTypeConverter extends DefaultTransformer {

	private final String STRING_INPUT = "input2";

	@SuppressWarnings("unused")
	private final String ARG = "input1";
	private final String INTEGER_OUTPUT = "string2integer_out";

	public void execute() {

		LinkedHashMap<String, Datum> inputs = getInput();
		dString input = (dString) inputs.get(STRING_INPUT);
		dInteger output = new dInteger(input.toString());

		Hashtable<String, Datum> outputs = new Hashtable<String, Datum>();

		outputs.put(INTEGER_OUTPUT, output);
		emit(outputs);
	}

}
